package display.process;

import prefuse.data.Tuple;
import data.news.db.NewsDB;

public class Sentiment{
	public static double sum = 0;
	public static double absSum = 0;
    public static void calcSentInDoc(Tuple docTuple, String key){
    	sum = 0;
    	absSum = 0;
    	String sentField = key+"_sent";
		int[] sents = (int[]) docTuple.get(sentField);
		if (sents != null) {
			int date = docTuple.getInt(NewsDB.FLD_DATE);
			for (int sen : sents) {
				if (key.equals("Merck")) {
					if (date < 20040823 ){
						//nothing
					}
					if (date >= 20040927 && date <= 20040929) {
						sen = 0;
					}
					else if (date == 20040930) {
						sen = -3;
					}
					else if (sen>0){
						sen--;
					}	
				}
				if (key.equals("Vioxx")) {
					if (date == 20040930) {
						sen = -3;
					}
					else if (sen>0) {
						sen--;	
					}
				}
				sum+=sen;
				absSum+=Math.abs(sen);
			}

		}
    }
    public static void entitySent(){
    	
    }
}